<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="java.util.*"%>
<%@page import="com.login.LoginVO"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String gid = request.getParameter("groupvo.id");
String gName = request.getParameter("groupvo.name");
gName = new String(com.util.Base64.decode(gName));
List<LoginVO> groupUserList = (List)request.getAttribute("groupUserList");
List<LoginVO> outUserList = (List)request.getAttribute("outUserList");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
  <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
  <title></title>
<style>.table-6 select{width:200px; height:200px}
#version {border:2px solid red; margin-left:10px;}
</style>
<script type="text/javascript" src="<%=path%>/js/jquery-1.9.1.min.js"></script>
<link rel='stylesheet' href='<%=path %>/manage/grouppriv/zh-cn.default.css?v=3.3' type='text/css' media='screen' />
<script type="text/javascript"> 
function selectAll(checker, scope){ 
    $('input[name='+scope+']').each(function(){
    	  $(this).attr("checked", checker.checked);
	});
}
function addUserWindow(){
	window.showModalDialog("<%=path %>/manage/grouppriv/adduser.jsp?gid=<%=gid %>",window,"status:no;scroll:no;dialogWidth:245px;dialogHeight:400px"); 
	window.location.href="<%=basePath%>/group/findAllGroup.action";
}
function deleteGroupUser(){
    var r=confirm("确定要删除您选定的这些项么?","确定","取消");
    if (r==false) {
        return false;
    }
	var form1 = document.getElementById("form1");
	form1.action = "<%=basePath%>/group/deleteGroupUser.action";
	return true;
}
function save(){
    var form1 = document.getElementById("form1");
	form1.action = "<%=basePath%>/group/modGroupUser.action";
	return true;
}
</script> 
</head>
<body>
<style> 
#colorbox, #cboxOverlay, #cboxWrapper{z-index:9999;}
</style>
<div>
<div class='outer'>
<%=gName %>
<form id="form1" method='post' action="">
  <input type='hidden' name='groupvo.id' value='<%=gid %>'/>
  <table class='table-1 a-left'> 
    <tr class='f-14px even'>
      <th class='a-right'>组内用户：<input type='checkbox' onclick='selectAll(this, "groupuser")' /></th>
      <td class='pv-10px' id='index'>
      <%
      	if(groupUserList!=null && groupUserList.size()>0){
      		for(LoginVO user:groupUserList){
      %>
        <div class='w-p20 f-left'>
          <input type='checkbox' checked name='groupuser' value='<%=user.getUsername() %>' />
          <span class='priv'><%=user.getName() %></span>
        </div>
      <%
      		}
      	}
      %>
      </td>
    </tr>
    <tr class='f-14px even'>
      <th class='a-right'>组外用户：<input type='checkbox' onclick='selectAll(this, "outuser")' /></th>
      <td class='pv-10px' id='index'>
      <%
      	if(outUserList!=null && outUserList.size()>0){
      		for(LoginVO user:outUserList){
      %>
        <div class='w-p20 f-left'>
          <input type='checkbox' name='outuser' value='<%=user.getUsername() %>' />
          <span class='priv'><%=user.getName() %></span>
        </div>
      <%
      		}
      	}
      %>
      </td>
    </tr>
    <tr>
      <td class='rowhead'></td>
      <td class='a-center'>
         <input type='button' id='adduser' value='新增用户' onclick='addUserWindow()' class='button-s' />
         <input type='submit' id='deleteUser' value='删除用户' onclick='return deleteGroupUser();' class='button-s' />
         <input type='submit' id='submit' value='保存' onclick='return save();' class='button-s' />  
         <input type='button' value='返回' class='button-c' onclick='location.href="<%=basePath%>/group/findAllGroup.action"' />
      </td>
    </tr>
  </table>
</form>
</div>
</div>
</body>
</html>